import axios from "axios";
import { BASE_URL } from "../config/http.js";
// 获取 token
function getToken() {
  return sessionStorage.getItem("token") || "";
}

// 获取单个用户信息
export function getUserById(userId) {
  return axios
    .get(`${BASE_URL}/api/user/${userId}`, {
      headers: { Authorization: "Bearer " + getToken() },
    })
    .then((res) => res.data);
}
